@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")

<%= render('kotlin/package.erb') %>

@JsModule("@trustwallet/wallet-core")
@JsName("<%= entity.name %>")
external interface Js<%= entity.name %> {
<%- entity.properties.each do |property| -%>
    fun <%= KotlinHelper.fix_name(WasmCppHelper.format_name(property.name)) %>()<%= KotlinHelper.js_return_type(property.return_type) %>
<%- end -%>
<%  unless entity.methods.select{ |x| x.name == "Delete" }.empty? -%>
    fun delete()
<% end -%>
<% entity.methods.each do |method| -%>
<%   next if method.name == "Delete" -%>
    fun <%= KotlinHelper.fix_name(WasmCppHelper.format_name(method.name)) %>(<%= KotlinHelper.js_parameters(method.parameters.drop(1)) %>)<%= KotlinHelper.js_return_type(method.return_type) %>
<% end -%>
    companion object {
<%  entity.static_methods.each do |method| -%>
        fun <%= KotlinHelper.fix_name(WasmCppHelper.function_name(entity: entity, function: method)) %>(<%= KotlinHelper.js_parameters(method.parameters) %>)<%= KotlinHelper.js_return_type(method.return_type) %>
<%  end -%>
    }
}

inline val JsWalletCore.<%= entity.name %>: Js<%= entity.name %>.Companion
    get() = asDynamic().<%= entity.name %>.unsafeCast<Js<%= entity.name %>.Companion>()
